package demo.ws.soap_spring_cxf;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;

/**
 * 通用动态代理客户端
 * 不仅用于调用JAX-WS方式发布的WS，也用于simple方式发布的WS
 */
public class DynamicClient {

    public static void main(String[] args){
        DynamicClientFactory factory = DynamicClientFactory.newInstance();
        Client client = factory.createClient("http://localhost:8080/ws/soap/hello?wsdl");
        try{
            Object[] results = client.invoke("say","world");
            System.out.println(results[0]);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
